package com.sean.order.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

// name: 远程服务名
// path: @RequestMapping("/stock")
@FeignClient(name = "stock-seata", path = "/stock")
public interface StockFeignService {
    // 声明需要调用的 rest 接口对应的方法
    @RequestMapping("/reduce/{productId}")
    public String reduce(@PathVariable("productId") Long productId); // 不需要实现类，底层是动态代理
}


/*

@RestController
@RequestMapping("/stock")
public class StockController {
    @Value("${server.port}")
    private String port;

    @RequestMapping("/reduce")
    private String reduce(){
        System.out.println("StockController: 扣减库存！");
        return "StockController: " + port;
    }
}
 */